<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script>
            //1.数据源
            var arr = [0,1,2,3,4,5,"A","B","C","D","E","F","G","H"]
            //2.随机验证码
            var show = "";
            for(var i = 1;i <5;i++){
                //3.随机下标 
                var index = parseInt(Math.random()*arr.length);
                show += arr[index]
            }
            //4.提示用户输入
            var input = prompt("请输入验证码:"+show);
            //.验证
            if(show.toUpperCase()==input.toUpperCase()){
                alert("输入正确")
            }else{
                alert("输入错误")
            }
    </script>
</head>
<body>
    
</body>
</html>